﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="quan_tri_thong_tin_san_pham.ascx.cs" Inherits="Admin_Module_quan_tri_thong_tin_san_pham" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<style type="text/css">
    .style1
    {
        width: 794px;
    }
</style>

<telerik:RadAjaxManager OnAjaxRequest="Ajax_Request" ID="RadAjaxManager1" runat="server" 
    DefaultLoadingPanelID="RadAjaxLoadingPanel1">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grd" />
            </UpdatedControls>
        </telerik:AjaxSetting>
       
        <telerik:AjaxSetting AjaxControlID="grd">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grd" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
</telerik:RadAjaxLoadingPanel>

<telerik:RadWindowManager OnClientClose="Window_Close" ID="RadWindowManager1" runat="server" >
    <Windows>
        <telerik:RadWindow VisibleStatusbar="false" Width="400px" Height="400px" runat="server" ID="windows1"></telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function Window_Close() {
            $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
        }

        
        </script>
    </script>
</telerik:RadCodeBlock>

<asp:Label runat="server" ID="lblMessage"></asp:Label>

<fieldset>
    <legend style="color: #0000FF; font-weight: 700; font-size: large">Danh Sách Sản Phẩm</legend>
    <table>
        <tr>
            <td class="style1"></td>
            <td><a href="/Admin/Form/Product_Add.aspx" ><img src="/Image/add2.png" alt="Thêm mới sản phẩm" title="Thêm mới sản phẩm" />Thêm Mới</a></td>
        </tr>
    </table>
      <fieldset>
        <legend>Tìm kiếm sản phẩm</legend>
        <table>
            <tr>
                <td>Tên sản phẩm</td>
                <td><asp:TextBox runat="server" ID="txtProductName"></asp:TextBox></td>
                <td>Nhóm sản phẩm</td>
                <td><asp:DropDownList runat="server" ID="cboCategory" DataTextField="FunctionPageName" DataValueField="FunctionPageID"></asp:DropDownList></td>
            </tr>
            <tr>
                <td>Từ giá</td>
                <td><telerik:RadNumericTextBox runat="server" ID="txtFromCurrentPrice"></telerik:RadNumericTextBox></td>
                <td>Đến giá</td>
                <td><telerik:RadNumericTextBox runat="server" ID="txtToCurrentPrice"></telerik:RadNumericTextBox></td>
            </tr>
            <tr>
                <td>Từ giá khuyến mại</td>
                <td><telerik:RadNumericTextBox runat="server" ID="txtFromDiscountPrice"></telerik:RadNumericTextBox></td>
                <td>Đến giá khuyến mại</td>
                <td><telerik:RadNumericTextBox runat="server" ID="txtToDiscountPrice"></telerik:RadNumericTextBox></td>
            </tr>
            <tr>
                <td colspan="4">
                    <asp:Button runat="server" ID="btnSearch" OnClick="btnSearch_Click" Text="Tìm kiếm" />
                </td>
            </tr>
        </table>
    </fieldset>
    <telerik:RadGrid runat="server" Skin="WebBlue" GridLines="Horizontal"  AllowFilteringByColumn="True" AutoGenerateColumns="false" ID="grd" AllowPaging="true" PageSize="20" OnPageIndexChanged="grd_OnPageIndexChanged">
        <MasterTableView>
            <Columns>
                <telerik:GridTemplateColumn HeaderText="Tên Sản Phẩm" DataField="ProductName">
                    <ItemTemplate>
                        <a href="/Admin/Form/Product_Add.aspx?id=<%#DataBinder.Eval(Container.DataItem,"ProductID")%>">
                            <%# Eval("ProductName")%>
                        </a>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="FunctionPageName" HeaderText="Tên Nhóm" AllowFiltering=true></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Unit" HeaderText="Mã" AllowFiltering=true></telerik:GridBoundColumn>
                <telerik:GridTemplateColumn HeaderText="Trạng Thái">
                    <ItemTemplate>
                            <%# Convert.ToBoolean(Eval("IsTypical"))? "MỚI" : "CŨ"%>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridImageColumn DataImageUrlFields="ProductImage" ImageHeight="80px" ImageWidth="100px" HeaderText="Ảnh" AllowFiltering=true></telerik:GridImageColumn>
                <telerik:GridBoundColumn DataField="CurrentPrice" HeaderText="Giá" AllowFiltering=true ></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="DiscountPrice" HeaderText="Giá Khuyến Mại" AllowFiltering=true ></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ProductAbstract" HeaderText="Folder Anh" AllowFiltering=true></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ViewTime" HeaderText="Số Lượt Xem" AllowFiltering=true></telerik:GridBoundColumn>
                <telerik:GridTemplateColumn HeaderText="Cập nhật tin liên quan">
                    <ItemTemplate>
                        <a href="#" onclick="openRadWindow('/Admin/Form/ProductNews_Add.aspx?id=<%# Eval("ProductID") %>','windows1'); return false;">
                            Cập nhật
                        </a>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Xóa">
                    <ItemTemplate>
                        <asp:LinkButton OnClientClick="return ConfirmDelete()" CausesValidation="false" OnClick="Product_Delete" CommandArgument='<%# Eval("ProductID") %>' ID="LinkButton2" runat="server">Xóa</asp:LinkButton>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
</fieldset>
